//
//  PPTViewController.m
//  WebView加载文件
//
//  Created by xiacl on 2018/9/5.
//  Copyright © 2018年 a2345. All rights reserved.
//

#import "PPTViewController.h"

@interface PPTViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webView;

@end

@implementation PPTViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"PPT";

    NSLog(@"%s", __func__);
    
    self.webView.scalesPageToFit = YES;
    
    NSString *str = [[NSBundle mainBundle] pathForResource:@"方法论.pptx" ofType:nil];
    NSCharacterSet *set = [NSCharacterSet URLQueryAllowedCharacterSet];
    NSString *encodedString = [str stringByAddingPercentEncodingWithAllowedCharacters:set];
    NSURL *url = [NSURL URLWithString:encodedString];
    
    //    NSData *data = [NSData dataWithContentsOfFile:str];
    //        [self.webView loadData:data MIMEType:@"application/vnd.openxmlformats-officedocument.wordprocessingml.document" textEncodingName:@"UTF-8" baseURL:nil];
    //
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
    
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    NSLog(@"%s", __func__);
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    NSLog(@"%s", __func__);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
